import greenfoot.*;

public class Tree extends MoveBckGr
{
    private int level;
    private GreenfootImage im;

    /**
     * Tree Constructor
     */
    public Tree( String title, int lev)
    {
        level=lev;
        im = new GreenfootImage( title);
        setImage( im);
    }

    /**
     * Method act
     */
    public void act()
    {
        super.shift( getX(), getY(), 3,0, level);
    }

    /**
     * Method top. It returns the value of the top in the position y.
     */
    public int top()
    {
        return (super.getY()-im.getHeight()/2);
    }
}
